<?php echo $this->Session->flash(); ?>
<h1 align="center">EDITAR FAMILIAR</h1>


<script>
    $(document).ready(function(){
        selectDiv();
        $('#parent').change(function() {


            selectDiv();


        });


    });

    function selectDiv(){
        if($('#parent option:selected').val()==9){
            $('#otro').show("slow");
            $('#otro').attr('disabled','');


        }else{

            $('#otro').hide("slow");
            $('#otro').attr('disabled','disabled');
            $('#otro').attr('value','¿cual?')



        }
    }


</script>

<fieldset>
    <?php
    if ($est == 1)
        $estado = "readonly";
    else
        $estado="";
    echo $form->create('Relative');
    if (isset($id))
        echo $form->hidden("Relative.id", array('value' => $id));
    else
        echo $form->hidden("Relative.id");
    echo $form->input('Relative.parentesco', array('readonly' => $estado, 'empty' => __('Seleccione ', true), 'label' => "Parentesco", 'type' => 'select', 'id' => 'parent', 'options' => array(1 => 'Hijo(a)', 2 => 'Hijastro(a)', 3 => 'Padre', 4 => 'Madre', 5 => 'Abuelo(a)', 6 => 'Nieto(a)', 7 => 'Primo(a)', 8 => 'Sobrino(a)', 9 => 'Otro')));
    echo $form->input("Relative.otro", array('readonly' => $estado, 'id' => 'otro', 'label' => ''));
    echo $form->input('Relative.tipo_ident', array('readonly' => $estado, 'label' => "Tipo identificacion", 'type' => 'select', 'options' => array(1 => 'C.C', 2 => 'T.I', 3 => 'Registro civil', 4 => 'NUI')));
    echo $form->input("Relative.nro_ident", array('readonly' => $estado));
    echo $form->input("Relative.nombres", array('readonly' => $estado));
    echo $form->hidden("Relative.candidate_id", array('readonly' => $estado));
    echo $form->input("Relative.1er_apellido", array('readonly' => $estado));
    echo $form->input("Relative.2do_apellido", array('readonly' => $estado));
    echo $form->input('Relative.genero', array('readonly' => $estado, 'empty' => __('Seleccione ', true), 'label' => "Genero", 'type' => 'select', 'selected' => $this->data['Relative']['genero'], 'options' => array(1 => 'Hombre', 2 => 'Mujer')));
    ?>
    <div id="loading" style="display: none;">
        <?php echo $html->image('loading.gif', array('border' => "0", 'align' => 'center')); ?>
    </div>
    <?php
    if ($est == 0)
        echo $ajax->submit('Guardar', array('url' => array('controller' => 'Relatives', 'action' => 'edit'), 'update' => 'content', 'complete' => 'cargar()', 'indicator' => 'loading'));
    echo $form->end();
    ?>
</fieldset>



